import { Column, CreateDateColumn, Entity, PrimaryColumn, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { dateTransformer } from '../../../../common/utils';

@Entity('anti_addiction_settings', {
  comment: '防沉迷设置表，存储应用的使用时间限制设置',
})
export class SettingsEntity {
  @PrimaryColumn({ type: 'int', name: 'child_id', comment: '孩子ID' })
  public childId: number;

  @Column({ type: 'tinyint', name: 'type', default: 1, comment: '类型，1为全天可用，2为全天禁用 3为禁用时段' })
  public type: number;

  @Column({ type: 'varchar', name: 'repeat_days', default: '', comment: '重复日期（如“周一,周二,周三”）' })
  public repeatDays: string;

  @Column({ type: 'tinyint', name: 'is_daily', default: 0, comment: '是否每日重复，0为否，1为是' })
  public isDaily: number;

  @Column({ type: 'int', name: 'start_hour', default: null, comment: '禁用时段开始小时' })
  public startHour: number;

  @Column({ type: 'int', name: 'start_minute', default: null, comment: '禁用时段开始分钟' })
  public startMinute: number;

  @Column({ type: 'int', name: 'end_hour', default: null, comment: '禁用时段结束小时' })
  public endHour: number;

  @Column({ type: 'int', name: 'end_minute', default: null, comment: '禁用时段结束分钟' })
  public endMinute: number;

  @Column({ type: 'char', name: 'del_flag', default: false, comment: '删除标志' })
  public delFlag: string;

  @CreateDateColumn({ type: 'datetime', name: 'create_time', default: null, transformer: dateTransformer, comment: '创建时间' })
  public createTime: Date;

  @UpdateDateColumn({ type: 'datetime', name: 'update_time', default: null, transformer: dateTransformer, comment: '更新时间' })
  public updateTime: Date;
}
